package uebung2;

public class A3 {
	
	public static void main(String[] args) {
		int[] a = {4,4,7,8,1,9};
		distributionCounting(a, 9);
		for(int i=0;i<a.length;++i)
			System.out.print(a[i]+" ");
	}
	
	public static void distributionCounting(int[]field,int m){
		int[] count = new int[m+1];
		
		for(int i=0;i<m;++i){
			count[i]=0;
		}
		
		for(int i=0;i<field.length;++i){
			++count[field[i]];
		}
		
		for(int i1=0,i2=0;i1<m;++i1){
			for(int i3=0;i3<count[i1];++i3){
				field[i2++]=i1;
			}
		}
	}
}

